package com.foundersoftware.commons.organization.model;

import java.util.Date;

public abstract class Type extends AbstractOrganizationObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3727362702026463308L;
	
	private TypeType type = null;
	
	
	private Date created = null;
	/**
	 * If the value of valid is false ,then it must not be in the droplist or combox box.
	 * But 
	 */
	private boolean valid = true;
	/**
	 * If the value of valid is false ,then invalidDate must not be null or empty.
	 */
	private Date invalidDate = null;
	/**
	 * this field is available for list order,for example combox box or drop list.
	 */
	private Integer listOrder;
	/**
	 * This field is available for table order.
	 */
	private Integer tableOrder;
	
	

    
	protected Type(String id ,String name,String displayName, Date created, boolean valid, Date invalidDate, Integer listOrder, Integer tableOrder) {
		super(id,name,displayName);
		//when instantiance subclass,auto set type.
		this.type = TypeType.valueOf(this.getClass().getSimpleName());
		this.created = created;
		this.valid = valid;
		this.invalidDate = invalidDate;
		this.listOrder = listOrder;
		this.tableOrder = tableOrder;
	}

	protected Type() {
		super();
		this.type = TypeType.valueOf(this.getClass().getSimpleName());
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getInvalidDate() {
		return invalidDate;
	}

	public void setInvalidDate(Date invalidDate) {
		this.invalidDate = invalidDate;
	}

	public Integer getListOrder() {
		return listOrder;
	}

	public void setListOrder(Integer listOrder) {
		this.listOrder = listOrder;
	}

	public Integer getTableOrder() {
		return tableOrder;
	}

	public void setTableOrder(Integer tableOrder) {
		this.tableOrder = tableOrder;
	}

	public boolean isValid() {
		return valid;
	}

	public void setValid(boolean valid) {
		this.valid = valid;
	}

	protected TypeType getType() {
		return type;
	}

	protected void setType(TypeType type) {
		this.type = type;
	}

}